﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Media.Imaging;

namespace MultiPhotoChooser
{
    public class PictureItem : IDisposable
    {
        public BitmapImage ThumbUrl { get; set; }

        public Stream ThumbStream { get; set; }
        public Stream ImageStream { get; set; }
        public string OriginalFileName { get; set; }
        public string FileNameFromDateTime 
        {
            get
            {
                return DateTime.Now.ToFileTime().ToString() + ".jpg";
            }
        }

        public DateTime Date { get; set; }

        public void Dispose()
        {
            if (ThumbUrl != null)
            {
                ThumbUrl.UriSource = null;
                ThumbUrl = null;
            } 

            if (ThumbStream != null)
                ThumbStream.Close();

            if (ImageStream != null)
                ThumbStream.Close();
        }
    }
}
